import { defHttp } from '@/utils/http/axios';
import { ErrorMessageMode } from '#/axios';
/**
 * 该部分接口为租户用户相关接口
 */
enum Api {
  getAccountList = '/users/getUsersListByPage',
  UpdateAccount = '/users/updateUser',
  AddAccount = '/users/addUser',
  DeleteAccount = '/users/deleteUser/',
  IsAccountExist = '/users/isUserNameExist',
  // 修改密码接口
  modifyPassword = '/platformAccount/updateUserPassword',
  //修改用户状态
  modifyUserStatus = '/users/updateUserStatus',
}
export const modifyUserStatus = (userId: string, status: number) =>
  defHttp.put({ url: Api.modifyUserStatus, params: { userId, status } });
export const modifyPassword = (params, mode: ErrorMessageMode = 'message') => {
  return defHttp.put<any>(
    { params, url: Api.modifyPassword },
    {
      errorMessageMode: mode,
    },);
}
export const getAccountList = (params) => {
  return defHttp.get<any>({ params,url: Api.getAccountList });
};
export const isAccountExist = (account) =>{
  return defHttp.get<any>({ params:{account},url: Api.IsAccountExist }, { errorMessageMode: 'none' });
}
export const UpdateUser = (params,mode: ErrorMessageMode = 'message')=>{
  return defHttp.put<any>({ params,url: Api.UpdateAccount },
    {
      errorMessageMode: mode,
    },)
}
export const AddAccount = (params, mode: ErrorMessageMode = 'message') => {
  return defHttp.post<any>({ params,url: Api.AddAccount },
    {
      errorMessageMode: mode,
    },);
};
export const DeleteAccount = (params, mode: ErrorMessageMode = 'message') => {
  return defHttp.delete<any>({ url: Api.DeleteAccount + params },
    {
      errorMessageMode: mode,
    },);
};
